#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n, m, x, y;
	priority_queue<int> a, b;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> x;
		a.push(x);
	}
	for (int i = 1; i <= m; i++) {
		cin >> y;
		b.push(y);
	}

	int ans = 0;
	while (!a.empty() && !b.empty()) {
		int at = a.top();
		int bt = b.top();
		b.pop();
		if (at >= bt) {
			ans++;
			a.pop();
		}
	}
	cout << ans;
	return 0;
}
